package com.biz.dataSource;

/**
 * @author: create by wucl
 * @version: v1.0
 * @description: com.lfrzzl.java.dataSource
 * @date:2018/9/5
 */
public class DataSourceContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

    public static void setDbType(String dbType) {
        contextHolder.set(dbType);
    }

    public static String getDbType() {
        return ((String) contextHolder.get());
    }
    //这个方法必不可少 否则切换数据库的时候有缓存现在
    public static void clearDbType() {
        contextHolder.remove();
    }
}
